<?php

/**
* @property DB_active_record $db
* @property Service $service
* @property Provider $provider
* @property Organisation_type $organisation_type
* */
class SearchByServices extends MY_Controller {
	
	public function __construct()
	{
		parent::__construct();

	}

	function index()
	{
		//$data['serviceList'] = $this->service->getAll() ;
		parent::add_data( 'serviceList' , $this->service->getAll()  );
		
		//$data['include_view'] = "Search/byService.php" ;
		//$this->load->view("_Shared/_Layout" , $data);
		//parent::view( "Search/View_SearchByService.php"  );
		parent::view( "SearchByServices/index.php"  );
	}
		
	function Search()
	{
		$serviceType = $_POST['chkServiceType'] ;
		$OrganisationType = $_POST['hidOrganisationType'] ;
		parent::check_null_show_error ( $serviceType , $OrganisationType ) ;
		
		// perlu ubah tabel, lum tau cara tentuin tipe provider nya
		
		parent::add_data( 'serviceList' , $this->service->getServiceList_byTypeId( $serviceType ) );
		parent::add_data( 'organisationTypeName' , $this->organisation_type->getOrginsationName_byId( $OrganisationType ) );
		
//
//		//echo $this->table->generate(  $this->provider->getAll()  );
//		
		parent::view( "SearchByServices/searchResult.php"  );

//pro_name
//		organisation_type
//		x,y
//	postal
	
//		ECHO "<PRE>";
//		ECHO var_dump( $this->provider->getAll()->result() );
//		ECHO "</PRE>";
		
		
		
//		show_error("testing");
//		show_404();
//		show_error('message' );
		

		
	}

	
}



// <editor-fold defaultstate="collapsed" desc="OLD_CODE">

//		$this->load->model("service");
//		$data['serviceList'] = $this->service->getAll() ;
//		$this->load->view('SearchByService', $data);
		//http://www.aic.sg/silverpages/eldercare/searchByServices.aspx#

//		$this->load->library('parser');
//
//		$data = array(
//					'blog_title' => 'My Blog Title'
//					, 'blog_heading' => 'My Blog Heading'
//					, 'body' => '< ? php include "bagian.php"  ? >'
//					);
//
//		$this->parser->parse('blog_template', $data);
////
////		//$this->load->view("bagian");
//		//$wew  = $this->load->view("bagian");
		
//		$data['bagiannya'] = "bagian.php" ;
//		$data['kedua'] = "keduanya" ;
//		$this->load->view("sebagian" , $data);
		
//		//$this->load->helper('url');
//		$this->load->helper('html');
//		
////		$data['include_view'] = "bagian.php" ;
//		$this->load->view("_Shared/_Layout" , $data);

//		getView ("")

		
//		$this->load->model("service");
//		$data['serviceList'] = $this->service->getAll() ;
//		
//		$this->load->helper('html');
//		$data['include_view'] = "Search/byService.php" ;
//		$this->load->view("_Shared/_Layout" , $data);

		
//		$this->load->model("base_flexmodel");
//		$this->load->model("provider");
//		ECHO "<PRE>";
//		ECHO var_dump($this->provider->insert ('1', 'Y', '3', 'a', '3', '3', 'B', 'U', '123', '3', '4', '5', '5') );
//		ECHO "</PRE>";
//			ECHO "<PRE>";
//			ECHO var_dump($this->provider->getProviderList() );
//			ECHO "</PRE>";
		
//		$this->load->model("base_flexmodel");
//		$this->load->model("service");
////		
////		
//		ECHO "<PRE>";
//		ECHO var_dump($this->service->getAll() );
//		ECHO "</PRE>";
//
//		$this->load->library('table');
//		echo $this->table->generate( $this->service->getAll() ); 
		
//		$vals = array(
//			'word' => 'Random word',
//			//'img_path' => './captcha/',
//			'img_path' => ROOTPATH . '/all_captcha/aic_new/',
//			//'img_url' => 'http://localhost/aic_new/captcha/',
//			'img_url' => 'http://localhost/all_captcha/aic_new/',
//			//'font_path' => './path/to/fonts/texb.ttf',
//			'img_width' => '150',
//			'img_height' => 30,
//			'expiration' => 7200
//			);
//
//		$cap = create_captcha($vals);
//		echo $cap['image'];
		
//		$abc = "xxx";
//		echo var_name ($abc);
		

//	function index33() {
//		$this->load->library('table');
//		
////
////		$data = array(
////					 array('Name', 'Color', 'Size'),
////					 array('Fred', 'Blue', 'Small'),
////					 array('Mary', 'Red', 'Large'),
////					 array('John', 'Green', 'Medium')
////					 );
////
////		echo $this->table->generate($data); 
//		
////		echo $this->table->generate( $this->provider->getAll() ); 
////			ECHO "<PRE>";
////			ECHO var_dump($this->provider->getAll());
////			ECHO "</PRE>";
//
////		$tmpl = array (
////			'table_open'          => '<table border="1" cellpadding="4" cellspacing="0">',
////
////			'heading_row_start'   => '<tr>',
////			'heading_row_end'     => '</tr>',
////			'heading_cell_start'  => '<th>',
////			'heading_cell_end'    => '</th>',
////
////			'row_start'           => '<tr>',
////			'row_end'             => '</tr>',
////			'cell_start'          => '<td>',
////			'cell_end'            => '</td>',
////
////			'row_alt_start'       => '<tr>',
////			'row_alt_end'         => '</tr>',
////			'cell_alt_start'      => '<td>',
////			'cell_alt_end'        => '</td>',
////
////			'table_close'         => '</table>'
////		);
////		$this->table->set_template($tmpl); 
////		
////		//$this->table->set_heading(array('Name', 'Color', 'Size'));
////		
////		echo $this->table->generate( $this->provider->getAll() ); 
//		
//		
//
//	}
	
// </editor-fold>
